package com.ctshk.app.user.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.enums.SystemError;
import com.ctshk.common.exception.BusinessException;
import com.ctshk.common.model.TokenUser;
import com.ctshk.common.web.support.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 *
 * </p>
 *
 * @author 李新科
 * @date 2021/5/24 18:49
 */
@Api(value="联系我们", tags="联系我们")
@RestController
public class CustomerServiceController extends BaseController {

    private static String customerServiceUrl = "https://yzf.qq.com/xv/web/static/chat/index.html?sign=37ef9b97d7700bc62b43c8bb4ab0e065b5feb3d0273c9dd7b5e314926360da26760380116e6c614445333fb2f0ae17dc3da3affb";

    @ApiOperation(value="客服", notes="客服")
    @OperationLogAnnotation(operModul = OperationLogModel.USER, operType = OperationLogType.QUERY, operTitle = "客服", operDesc = "客服")
    @PostMapping("/customerService")
    public Result<String> customerService() throws Exception{
        TokenUser currentUser = null;
        try {
            currentUser = getCurrentUser();
        } catch (Exception e) {
        }
        if(currentUser != null) {
            customerServiceUrl = customerServiceUrl + "&Uid=" + currentUser.getId();
        }
        return Result.success(customerServiceUrl);
    }
}
